<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <script src="https://cdn.jsdelivr.net/npm/vue@2.5.21/dist/vue.js" type="text/javascript"charset="utf-8"></script>
    </head>

    <body>
        <!-- view -->
        <div id="app">
            <p>methods: {{currentTime1()}}</p>
            <p>计算属性: computed, {{currentTime2}}</p>
        </div>


        <script type="text/javascript">
            let app = new Vue({
                el: "#app",
                data: {
                  message: "悬停显示信息"
                },
                methods: {
                  currentTime1: function () {
                    return Date.now();
                  }
                },
                // 调用方法时每次都要计算，会产生开销，如果结果不经过变化，可以通过计算结果缓存起来，以节约开销
                computed: {
                  currentTime2: function () {
                    return Date.now();
                  }
                }
            })
        </script>
    </body>
</html>